<template>
  <base-form ref="testForm" :model="model" :formItems="formItems"> </base-form>
</template>

<script setup lang="ts">
import { useOptsStore } from '@/store/useOptsStore'
const store = useOptsStore()
let powerType = computed(() => store.powerType)
const obj = reactive({
  model: {
    name: '',
    age: '',
    gender: null,
    time: null,
  },
  formItems: [
    {
      prop: 'name',
      label: '姓名',
      is: 'el-input',
    },
    {
      prop: 'age',
      label: '年龄',
      is: 'el-input',
      attrs: {
        onFocus: () => {
          console.log('1', 1)
        },
      },
    },
    {
      prop: 'gender',
      label: '性别',
      is: 'el-select',
      attrs: {
        placeholder: 'Pick a 233',
        clearable: true,
        onFocus: () => {
          store.getPowerType()
        },
      },
      options: powerType,
    },
    {
      prop: 'time',
      label: '时间',
      is: 'el-date-picker',
      attrs: {
        type: 'date',
        placeholder: 'Pick a day',
      },
    },
  ],
})
const testForm = ref(null)
const { model, formItems } = toRefs(obj)
</script>

<style scoped></style>
